package com.web.pendingList.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.web.common.PendingAmend;
import lombok.Data;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author wenzhuo
 * @create 2024-03-06 2024/3/6
 */
@Data
@ToString
public class PendingList implements Serializable {

    private Integer pendingNum;

    private String txType;

    private String module;

    private String requestType;

    private String status;

    private String maker;

    private String approver;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
    private LocalDateTime requestDateTime;

    private String remark;


    public static PendingList makeReject(PendingList pendingTxn){
        pendingTxn.setStatus(PendingAmend.pending_reject);
        return pendingTxn;
    }

    public static PendingList makeApprove(PendingList pendingTxn){
        pendingTxn.setStatus(PendingAmend.pending_approve);
        return pendingTxn;
    }

}
